public class EqualsTest1 {
    public static void main(String[] args) {
        // 新建两个相同的Person对象
        // 再利用equals比较两者是否是相同的
        Person p1=new Person("eee",100);
        Person p2=new Person("eee",100);
        System.out.print(p1.equals(p2));

    }
    // 定义Person类
    private static class Person{
        int age;
        String name;


        public Person() {
        }

        public Person(String name,int age) {
            this.age = age;
            this.name = name;
        }

        public String toString() {
            return "Person{age = " + age + ", name = " + name + "}";
        }
    }
}
